function createGoBoard(size)
{
  $("#boardContainer").append('<table id="board" class="board" cellspacing="0" cellpadding="0"></table>');
  
  for(var y=0; y<size; y++)
  {
    rowId='row_'+y;
    $("#board").append('<tr id="'+rowId+'" class="boardRow"></tr>');

    for(var x=0; x<size; x++)
    {
      cellId='cell_'+x+'_'+y;
      $("#"+rowId).append('<td id="'+cellId+'" class="boardCell"></td>');
    }
  }
}

function createHexBoard(sideSize)
{
  var size=sideSize*2;
  var start=sideSize/2;
  var end=start+sideSize;

  $("#boardContainer").append('<table id="board" class="board" cellspacing="0" cellpadding="0"></table>');

  var tiles=[['topleft','topright'],['left','right'],['left2','right2'],['bottomleft','bottomright']];

  for(var y=0; y<size-1; y++)
  {
    if(y%2==0)
    {
      for(var i=0; i<4; i++)
      {
        var hexX=0;
        
        rowId='row_'+y+'_'+i;
        $("#board").append('<tr id="'+rowId+'" class="boardRow"></tr>');

        for(var x=0; x<size; x++)
        {
          for(var j=0; j<2; j++)
          {
            cellId='cell_'+x+'_'+j+'_'+y+'_'+i;
            if((x==(start-1) && x<end && i==3 && j==1 && y<sideSize) || (x==(start-1) && i==0 && j==1 && y>=sideSize) || (x>=end && x<(end+1) && i==3 && j==0 && y<sideSize) || (x>=end && x<(end+1) && i==0 && j==0 && y>=sideSize) || (x>=start && x<end))
            {
              if(i==0 || i==3)
              {
                $("#"+rowId).append('<td id="'+cellId+'" class="hexBoarderCell '+tiles[i][j]+'"></td>');
              }
              else
              {
                var hexpos=x+'_'+y;
                $("#"+rowId).append('<td id="'+cellId+'" class="hexBoardCell '+tiles[i][j]+'" hexpos="'+hexpos+'"></td>');
              }
            }
            else
            {
              $("#"+rowId).append('<td id="'+cellId+'" class="boardCell invisible"></td>');
            }
          }
        }
      }  
    }
    else
    {
      for(var i=1; i<3; i++)
      {
        var hexX=0;
      
        rowId='row_'+y+'_'+i;
        $("#board").append('<tr id="'+rowId+'" class="boardRow"></tr>');

        for(var x=0; x<size; x++)
        {
          for(var j=1; j>-1; j--)
          {
            cellId='cell_'+x+'_'+j+'_'+y+'_'+i;
            if((x>(start-1) && x<=start && j==0) || (x>(end-1) && x<(end) && j==1) || (x>=start && x<(end-1)))
            {
              var hexpos=hexX+'_'+y;
              $("#"+rowId).append('<td id="'+cellId+'" class="hexBoardCell '+tiles[i][j]+'" hexpos="'+hexpos+'"></td>');
            }
            else
            {
              $("#"+rowId).append('<td id="'+cellId+'" class="boardCell invisible"></td>');
            }
            
            if(j==1)
            {
              hexX=hexX+1;
            }
          }          
        }
      }  
    }
    
    if(y<(sideSize-1))
    {
      start=start-0.5;
      end=end+0.5;
    }
    else
    {
      start=start+0.5;
      end=end-0.5;
    }
  }  
}